package a.j;

import a.c.e;
import a.d.s;
import a.i.lb;

import java.awt.*;
import java.awt.geom.Rectangle2D;
import java.util.*;
import java.util.List;

public class x
  extends w
{
  private Collection m;
  private a.c.k n;
  private lb o;
  private List p;
  private lb q;
  public static int r;
  
  public x()
  {
    this(null);
  }
  
  public x(pg parampg)
  {
    super(parampg);
  }
  
  public void g()
  {
    super.g();
    this.m = null;
    this.q = (this.o = null);
    this.n = null;
    this.p = null;
  }
  
  public void a(a.d.w paramw, Collection paramCollection, a.c.k paramk)
  {
    boolean bool2 = ld.E;
    boolean bool1 = ld.D;
    a(paramw);
    pg localpg = d();
    h();
    this.m = paramCollection;
    this.n = paramk;
    this.q = new lb();
    this.o = new lb();
    HashSet localHashSet = new HashSet(paramCollection);
    ArrayList localArrayList = new ArrayList(localpg.a().j() - localHashSet.size());
    a(paramCollection, localArrayList);
    Iterator localIterator = localArrayList.iterator();
    do
    {
      do
      {
        e locale;
        ld localld;
        do
        {
          if (!localIterator.hasNext()) {
            break;
          }
          locale = (e)localIterator.next();
          localld = localpg.a().w(locale);
        } while (!a(localld));
        a(locale, localld.c(), this.o);
        a(locale, localld.d(), this.q);
        if ((bool2) || ((!bool2) && (bool1))) {
          return;
        }
      } while (bool2);
    } while (!bool1);
    this.p = a(localArrayList);
  }
  
  protected List a(Collection paramCollection)
  {
    boolean bool2 = ld.E;
    boolean bool1 = ld.D;
    ArrayList localArrayList = new ArrayList();
    Iterator localIterator = paramCollection.iterator();
    if (localIterator.hasNext()) {}
    while (bool2)
    {
      e locale = (e)localIterator.next();
      a(locale, localArrayList);
      if (!bool1) {
        break;
      }
    }
    return localArrayList;
  }
  
  protected void a(e parame, Collection paramCollection)
  {
    g localg = d().a();
    ld localld = localg.w(parame);
    if ((ld.E) || (a(localld))) {
      a(localld, paramCollection);
    }
  }
  
  protected void a(ld paramld, Collection paramCollection)
  {
    double d1 = paramld.A();
    double d2 = paramld.b();
    paramCollection.add(new ue((byte)0, (byte)1, new a.d.w(d1, d2), null, 1.0D));
    double d3 = paramld.d();
    double d4 = d2 + d3;
    paramCollection.add(new ue((byte)0, (byte)2, new a.d.w(d1, d4), null, 1.0D));
    double d5 = paramld.c();
    double d6 = paramld.a();
    double d7 = d6 + d5;
    paramCollection.add(new ue((byte)0, (byte)2, new a.d.w(d1, d2), d6, d7, null, 1.0D));
    paramCollection.add(new ue((byte)0, (byte)1, new a.d.w(d1, d4), d6, d7, null, 1.0D));
    double d8 = paramld.B();
    paramCollection.add(new ue((byte)1, (byte)4, new a.d.w(d6, d8), null, 1.0D));
    paramCollection.add(new ue((byte)1, (byte)8, new a.d.w(d7, d8), null, 1.0D));
    paramCollection.add(new ue((byte)1, (byte)8, new a.d.w(d6, d8), d2, d4, null, 1.0D));
    paramCollection.add(new ue((byte)1, (byte)4, new a.d.w(d7, d8), d2, d4, null, 1.0D));
  }
  
  private void a(e parame, double paramDouble, lb paramlb)
  {
    boolean bool2 = ld.E;
    boolean bool1 = ld.D;
    Object localObject = new b_(paramDouble);
    lb.b_ localb_ = paramlb.c(localObject);
    if (!bool2) {
      if (localb_ == null)
      {
        if (!bool2) {
          if (paramlb.c() == 0)
          {
            paramlb.a(localObject);
            if (bool2) {
              break label214;
            }
            if (!bool1) {
              break label205;
            }
          }
        }
        b_ localb_1 = (b_)paramlb.g().c();
        if (!bool2)
        {
          if (localb_1.a == paramDouble)
          {
            localObject = localb_1;
            if (bool2) {
              break label214;
            }
            if (!bool1) {
              break label205;
            }
          }
          paramlb.b(paramlb.g(), localObject);
        }
        if (bool2) {
          break label214;
        }
        if (!bool1) {
          break label205;
        }
      }
    }
    if (!bool2) {
      if (localb_.a() != null)
      {
        if (bool2) {
          break label204;
        }
        if (((b_)localb_.a().c()).a == paramDouble)
        {
          localObject = (b_)localb_.a().c();
          if (bool2) {
            break label214;
          }
          if (!bool1) {
            break label205;
          }
        }
      }
    }
    label204:
    paramlb.a(localb_, localObject);
    label205:
    label214:
    ((b_)localObject).c.add(parame);
  }
  
  public a.d.w a(a.d.w paramw, byte paramByte, boolean paramBoolean1, boolean paramBoolean2)
  {
    boolean bool2 = ld.E;
    boolean bool1 = ld.D;
    a.d.w localw = l();
    i();
    if (!bool2) {
      if (this.o.c() == 0) {
        return paramw;
      }
    }
    if ((bool2) || (paramBoolean1)) {
      switch (paramByte)
      {
      case 0: 
      case 2: 
      case 3: 
      case 5: 
        return paramw;
      }
    }
    double d1 = paramw.a - localw.a;
    double d2 = paramw.b - localw.b;
    double d4;
    double d3;
    double d5;
    double d6;
    double d7;
    double d8;
    switch (paramByte)
    {
    case 7: 
      d4 = 0.0D;
      d3 = 1.0D;
      d5 = paramBoolean2 ? -1.0D : 0.0D;
      d6 = 0.0D;
      d7 = 1.0D;
      d8 = 0.0D;
      if (!bool2) {
        if (!bool1) {
          break;
        }
      }
      break;
    case 2: 
      d4 = -1.0D;
      d3 = 1.0D;
      d5 = paramBoolean2 ? -1.0D : 0.0D;
      d6 = 1.0D;
      d7 = 1.0D;
      d8 = paramBoolean2 ? -1.0D : 0.0D;
      if (!bool2) {
        if (!bool1) {
          break;
        }
      }
      break;
    case 5: 
      d4 = 1.0D;
      d3 = 1.0D;
      d5 = paramBoolean2 ? -1.0D : 0.0D;
      d6 = paramBoolean2 ? -1.0D : 0.0D;
      d7 = 1.0D;
      d8 = 1.0D;
      if (!bool2) {
        if (!bool1) {
          break;
        }
      }
      break;
    case 6: 
      d4 = 0.0D;
      d3 = -1.0D;
      d5 = 1.0D;
      d6 = 0.0D;
      d7 = paramBoolean2 ? -1.0D : 0.0D;
      d8 = 0.0D;
      if (!bool2) {
        if (!bool1) {
          break;
        }
      }
      break;
    case 3: 
      d4 = 1.0D;
      d3 = -1.0D;
      d5 = 1.0D;
      d6 = paramBoolean2 ? -1.0D : 0.0D;
      d7 = paramBoolean2 ? -1.0D : 0.0D;
      d8 = 1.0D;
      if (!bool2) {
        if (!bool1) {
          break;
        }
      }
      break;
    case 0: 
      d4 = -1.0D;
      d3 = -1.0D;
      d5 = 1.0D;
      d6 = 1.0D;
      d7 = paramBoolean2 ? -1.0D : 0.0D;
      d8 = paramBoolean2 ? -1.0D : 0.0D;
      if (!bool2) {
        if (!bool1) {
          break;
        }
      }
      break;
    case 1: 
      d4 = -1.0D;
      d3 = 0.0D;
      d5 = 0.0D;
      d6 = 1.0D;
      d7 = 0.0D;
      d8 = paramBoolean2 ? -1.0D : 0.0D;
      if (!bool2) {
        if (!bool1) {
          break;
        }
      }
      break;
    case 4: 
      d4 = 1.0D;
      d3 = 0.0D;
      d5 = 0.0D;
      d6 = paramBoolean2 ? -1.0D : 0.0D;
      d7 = 0.0D;
      d8 = 1.0D;
      if (!bool2) {
        if (!bool1) {
          break;
        }
      }
      break;
    default: 
      d3 = d4 = 0.0D;
      d5 = d6 = 0.0D;
      d7 = d8 = 0.0D;
    }
    if (paramBoolean2)
    {
      d3 *= 2.0D;
      d4 *= 2.0D;
    }
    double d9 = d1 * d3;
    double d10 = d2 * d4;
    double d11 = d5 * d1;
    double d12 = d6 * d2;
    ArrayList localArrayList = new ArrayList(5);
    double d13 = f() / d().M();
    Iterator localIterator = this.m.iterator();
    label626:
    label633:
    do
    {
      break label1034;
      break label1034;
      break label1034;
      break label1034;
      break label1034;
      break label1034;
      break label1034;
      break label1034;
      break label1034;
      break label1034;
      break label1034;
      break label1034;
      e locale;
      Rectangle2D.Double localDouble;
      while (localIterator.hasNext())
      {
        locale = (e)localIterator.next();
        try
        {
          localDouble = (Rectangle2D.Double)this.n.get(locale);
          if (localDouble == null) {
            if (!bool1) {
              continue;
            }
          }
        }
        catch (Exception localException) {}
      }
      double d14 = localDouble.getX() + d11;
      double d15 = localDouble.width + d9;
      double d16 = d14 + d15;
      double d17 = localDouble.getY() + d12;
      double d18 = localDouble.height + d10;
      double d19 = d17 + d18;
      qe localqe = d().a().w(locale).L();
      if ((bool2) || (localqe != null))
      {
        localObject = localqe.k();
        if (!bool2)
        {
          if (localObject != null)
          {
            if (!bool2) {
              if (d15 - d13 < ((s)localObject).a) {
                d3 = d5 = d7 = 0.0D;
              }
            }
            if ((bool2) || (d18 - d13 < ((s)localObject).b)) {
              d4 = d6 = d8 = 0.0D;
            }
          }
          localObject = localqe.l();
        }
        if (localObject != null)
        {
          if (!bool2) {
            if (d15 + d13 > ((s)localObject).a) {
              d3 = d5 = d7 = 0.0D;
            }
          }
          if (bool2) {
            break label912;
          }
          if (d18 + d13 > ((s)localObject).b) {
            d4 = d6 = d8 = 0.0D;
          }
        }
      }
      if (!bool2) {
        if (d3 != 0.0D)
        {
          localObject = a(locale, 1.0D / d3, d15, this.o, paramw.a, true);
          if (bool2) {
            break label972;
          }
          if (((ve)localObject).b() > 0.0D) {
            localArrayList.add(localObject);
          }
        }
      }
      if (d4 != 0.0D)
      {
        if (bool2) {
          break label1024;
        }
        localObject = a(locale, 1.0D / d4, d18, this.q, paramw.b, false);
        if (((ve)localObject).b() > 0.0D) {
          localArrayList.add(localObject);
        }
      }
      Object localObject = this.p.iterator();
      do
      {
        if (!((Iterator)localObject).hasNext()) {
          break label626;
        }
        ue localue = (ue)((Iterator)localObject).next();
        if (bool2) {
          break label912;
        }
        do
        {
          if (!bool2) {
            if (localue.c() == 1)
            {
              if (!bool2) {
                if (localue.d() == 4)
                {
                  if (((!bool2) && (d5 == 0.0D)) || ((!bool2) && ((localue.e() >= d19) || ((!bool2) && (localue.f() <= d17))))) {
                    break;
                  }
                  d20 = localue.b().a - d14;
                  if ((!bool2) && (Math.abs(d20) >= d13)) {
                    break;
                  }
                  d21 = d13 - Math.abs(d20);
                  localArrayList.add(ve.a(d21, localue, true, paramw.a + d20 * d5));
                }
              }
              if (((!bool2) && (!bool1)) || ((!bool2) && (localue.d() != 8))) {
                break;
              }
              if (((!bool2) && (d7 == 0.0D)) || ((!bool2) && ((localue.e() >= d19) || ((!bool2) && (localue.f() <= d17))))) {
                break;
              }
              d20 = localue.b().a - d16;
              if ((!bool2) && (Math.abs(d20) >= d13)) {
                break;
              }
              d21 = d13 - Math.abs(d20);
              localArrayList.add(ve.a(d21, localue, true, paramw.a + d20 * d7));
              if ((!bool2) && (!bool1)) {
                break;
              }
            }
          }
          if (!bool2) {
            if (localue.d() == 1)
            {
              if (((!bool2) && (d6 == 0.0D)) || ((!bool2) && ((localue.e() >= d16) || ((!bool2) && (localue.f() <= d14))))) {
                break;
              }
              d20 = localue.b().b - d17;
              if ((!bool2) && (Math.abs(d20) >= d13)) {
                break;
              }
              d21 = d13 - Math.abs(d20);
              localArrayList.add(ve.a(d21, localue, false, paramw.b + d20 * d6));
            }
          }
          if (((!bool2) && (!bool1)) || (localue.d() != 2)) {
            break;
          }
        } while (bool2);
        if (bool1) {
          break label633;
        }
        if ((d8 == 0.0D) || ((!bool2) && ((localue.e() >= d16) || ((!bool2) && (localue.f() <= d14))))) {
          break;
        }
        double d20 = localue.b().b - d19;
        if ((!bool2) && (Math.abs(d20) >= d13)) {
          break;
        }
        double d21 = d13 - Math.abs(d20);
        localArrayList.add(ve.a(d21, localue, false, paramw.b + d20 * d8));
      } while (bool2);
    } while (!bool1);
    label912:
    label972:
    return a(localArrayList, paramw);
  }
  
  private ve a(e parame, double paramDouble1, double paramDouble2, lb paramlb, double paramDouble3, boolean paramBoolean)
  {
    boolean bool2 = ld.E;
    boolean bool1 = ld.D;
    double d1 = f() / d().M();
    lb.b_ localb_1 = paramlb.c(new b_(paramDouble2));
    if (!bool2) {}
    lb.b_ localb_2 = localb_1 != null ? localb_1.a() : paramlb.g();
    double d2 = (bool2) || (localb_1 != null) ? ((b_)localb_1.c()).a - paramDouble2 : (1.0D / 0.0D);
    double d3 = (bool2) || (localb_2 != null) ? ((b_)localb_2.c()).a - paramDouble2 : (1.0D / 0.0D);
    double d4;
    b_ localb_;
    if (!bool2) {
      if (Math.abs(d2) < d1)
      {
        if (!bool2) {
          if (Math.abs(d3) < Math.abs(d2))
          {
            d4 = d3 * paramDouble1;
            localb_ = (b_)localb_2.c();
            if (bool2) {
              break label271;
            }
            if (!bool1) {
              break label262;
            }
          }
        }
        d4 = d2 * paramDouble1;
        localb_ = (b_)localb_1.c();
        if (bool2) {
          break label271;
        }
        if (!bool1) {
          break label262;
        }
      }
    }
    if ((bool2) || (Math.abs(d3) < d1))
    {
      d4 = d3 * paramDouble1;
      localb_ = (b_)localb_2.c();
      if (bool2) {
        break label271;
      }
      if (!bool1) {}
    }
    else
    {
      return ve.h;
    }
    label262:
    label271:
    double d5 = (bool2) || (d4 != 0.0D) ? 1.0D / (1.0D + Math.abs(d4)) : 1.0D;
    double d6 = d4 + paramDouble3;
    qb local0 = new qb()
    {
      private final x.b_ val$winningEntry;
      private final boolean val$horizontalSnap;
      private final e val$contextNode;
      
      public void paint(Graphics2D paramAnonymousGraphics2D)
      {
        boolean bool2 = ld.E;
        boolean bool1 = ld.D;
        g localg = x.this.d().a();
        paramAnonymousGraphics2D.setColor(x.this.a());
        Iterator localIterator = this.val$winningEntry.c.iterator();
        if (localIterator.hasNext()) {}
        while (bool2)
        {
          e locale = (e)localIterator.next();
          x.this.a(paramAnonymousGraphics2D, localg, locale, this.val$horizontalSnap);
          if ((!bool2) && (bool1)) {
            return;
          }
          if (!bool1) {
            break;
          }
        }
        x.this.a(paramAnonymousGraphics2D, localg, this.val$contextNode, this.val$horizontalSnap);
      }
      
      public Rectangle getBounds()
      {
        boolean bool2 = ld.E;
        boolean bool1 = ld.D;
        g localg = x.this.d().a();
        Rectangle2D.Double localDouble = new Rectangle2D.Double(0.0D, 0.0D, -1.0D, -1.0D);
        Iterator localIterator = this.val$winningEntry.c.iterator();
        if (localIterator.hasNext()) {}
        while (bool2)
        {
          e locale = (e)localIterator.next();
          Rectangle2D localRectangle2D = x.this.a(localg, locale, this.val$horizontalSnap);
          if (bool2) {
            break label135;
          }
          a.d.k.a(localDouble, localRectangle2D, localDouble);
          if (bool1) {
            break label134;
          }
          if (!bool1) {
            break;
          }
        }
        a.d.k.a(localDouble, x.this.a(localg, this.val$contextNode, this.val$horizontalSnap), localDouble);
        label134:
        label135:
        return localDouble.getBounds();
      }
    };
    return ve.a(d5, local0, paramBoolean, d6);
  }
  
  private Rectangle2D a(g paramg, e parame, boolean paramBoolean)
  {
    ld localld = paramg.w(parame);
    if (paramBoolean)
    {
      if (ld.E) {
        break label107;
      }
      localDouble = new Line2D.Double(localld.a(), localld.b() - 15.0D, localld.a() + localld.c(), localld.b() + 10.0D);
      if (!ld.D) {
        break label109;
      }
    }
    label107:
    Line2D.Double localDouble = new Line2D.Double(localld.a() - 15.0D, localld.b(), localld.a() + 10.0D, localld.b() + localld.d());
    label109:
    return localDouble.getBounds2D();
  }
  
  private void a(Graphics2D paramGraphics2D, g paramg, e parame, boolean paramBoolean)
  {
    boolean bool = ld.E;
    ld localld = paramg.w(parame);
    if (!bool)
    {
      if (paramBoolean)
      {
        if (bool) {
          break label106;
        }
        a(paramGraphics2D, localld.a(), localld.b() - 5.0D, localld.a() + localld.c(), localld.b() - 5.0D);
      }
    }
    else if (!ld.D) {
      return;
    }
    label106:
    a(paramGraphics2D, localld.a() - 5.0D, localld.b(), localld.a() - 5.0D, localld.b() + localld.d());
  }
  
  private static final class b_
    implements Comparable
  {
    final double a;
    final ArrayList c = new ArrayList();
    
    b_(double paramDouble)
    {
      this.a = paramDouble;
    }
    
    public int compareTo(Object paramObject)
    {
      b_ localb_ = (b_)paramObject;
      return l.a(this.a, localb_.a);
    }
    
    public String toString()
    {
      return "Entry{nodes=" + this.c + ", size=" + this.a + '}';
    }
  }
}



/* Location:           E:\idea\

 * Qualified Name:     a.j.getDefaultLicenseInfoEx

 * JD-Core Version:    0.7.0.1

 */